package com.practice.draw

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

/**
 * Created by lgs on 2018/7/19.
 */
class PageFragment : Fragment() {

    private var practiceLayoutRes: Int? = null

    companion object {
        fun newInstance(layoutRes: Int): PageFragment {
            val fragment = PageFragment()
            val args = Bundle()
            args.putInt("layoutRes", layoutRes)
            fragment.arguments = args
            return fragment
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (null != arguments)
            practiceLayoutRes = arguments!!.getInt("layoutRes")
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(practiceLayoutRes!!, container, false)
    }
}